#include "tinyxml.h"

#include "../DataModule.h"

#include <list>

#define NUM_AREAS 32*40

class Door {
  private: 
    uint x, y, type, misc;

    // "Destination" stuff
    uint pointer;
    uint flag;
    uint destX, destY;
    uint style, direction;
  public:
    Door(uint x, uint y, uint type, uint ptr, Rom& rom);
    Door(TiXmlElement* entry, std::map<std::string, int> &labels);
    TiXmlElement* createXmlEntry();

    int getStairsDirection();
    void setStairsDirection(int dir);
    void setTypeFromString(const char* str);
};

class DoorModule: public DataModule {
  private:
    std::list<Door*> doors[NUM_AREAS];
  public:
    ~DoorModule();
    const char* getName();
    const char* getCredits();

    void readFromRom(Rom& rom);
    void writeToRom(Rom& rom);
    void readFromDat(char* dirName, std::map<std::string, std::string> &fns, std::map<std::string, int> &labels);
    void writeToDat(char* dirName, std::map<std::string, std::string> &fns);
};
